/* 组件样式 */

/* 模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
  font-weight: 600;
}

.close-btn {
  font-size: 1.8rem;
  cursor: pointer;
  color: #aaa;
  transition: color 0.2s ease;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover {
  color: #666;
  background: #f8f9fa;
}

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

/* ==================== 下拉菜单核心样式 ==================== */
.dropdown {
  position: relative;
  display: inline-block;
  z-index: 10;
}

.dropdown-menu {
  display: none;
  position: absolute;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999 !important; /* 确保在最顶层 */
  min-width: 140px;
  text-align: left;
  top: calc(100% + 5px);
  left: 0;
  transform: translateY(0);
  padding: 0.25rem 0;
  /* 添加边界检测，防止菜单超出视窗 */
  max-height: 300px;
  overflow-y: auto;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

/* 如果hover时菜单不希望消失，可以使用一个延迟机制 */
.dropdown.keep-open .dropdown-menu {
  display: block;
}

/* ==================== 核心修复：统一下拉菜单项样式 ==================== */
.dropdown-item {
  display: block;
  width: 100% !important;
  padding: 8px 12px !important;
  text-align: left !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  font-size: 0.8rem !important;
  color: #495057 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-weight: normal !important;
  line-height: 1.5 !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
  margin: 0 !important;
  transition: background-color 0.2s ease !important;
}

/* 确保可以通过JavaScript控制可见性 */
.dropdown-item[style*="display: none"] {
  display: none !important;
}

.dropdown-item:hover {
  background-color: #f8f9fa !important;
  color: #495057 !important;
}

/* 确保子元素不会破坏样式 */
.dropdown-item * {
  font-size: inherit !important;
  color: inherit !important;
  font-weight: inherit !important;
  background: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 系统模板标签样式 */
.system-template-badge {
  background: #667eea;
  color: white;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 4px;
  margin-left: 5px;
}

/* 防止外部状态样式污染 */
.dropdown-item .case-status,
.dropdown-item .case-status-closed,
.dropdown-item .case-status-open {
  all: unset !important;
  font-size: 0.8rem !important;
  color: #495057 !important;
  background: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline !important;
}